package com.example.g2daylx2.adapter

import android.annotation.SuppressLint
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.example.g2daylx2.R
import com.example.lib_base.net.entity.CarEntityResultItem

class CarAdapter:BaseQuickAdapter<CarEntityResultItem,BaseViewHolder>(R.layout.item_park) {
    override fun convert(helper: BaseViewHolder, item: CarEntityResultItem) {

        helper.setText(R.id.park_status,item.spaceStatus)
        helper.setText(R.id.park_type,item.userName)
        helper.setText(R.id.park_carNo,item.licensePlate)
        if (item.spaceStatus == "空闲"){
            helper.getView<TextView>(R.id.park_status).setBackgroundResource(R.color.purple_500)
        }else if (item.spaceStatus == "已占用"){
            helper.getView<TextView>(R.id.park_status).setBackgroundResource(R.color.purple_700)
        }else {
            helper.getView<TextView>(R.id.park_status).setBackgroundResource(R.color.purple_200)
        }
    }
}